import 'package:flutter/cupertino.dart';

/// 点击页面空白区域 释放键盘
class CloseSoftKeyBoardWidget extends StatelessWidget {
  final Widget child;
  final HitTestBehavior? behavior;

  const CloseSoftKeyBoardWidget({super.key, required this.child, this.behavior});

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      behavior: behavior ?? HitTestBehavior.translucent,
      onTap: () => FocusScope.of(context).requestFocus(FocusNode()),
      child: child,
    );
  }
}
